/*
 * @Date: 2019-09-16 10:25:48
 * @LastEditTime: 2021-04-09 00:49:56
 * @Description: file content
 */
const axios = require('axios')

const $axios = axios.create({
  timeout: 30000, // 30秒
  responseType: 'json'
})


exports.post = (url, params, headers) => new Promise((resolve, reject) => {
  let addHeaders = {
    zzbs: 'bbPro',
    channel: 'zmd',
    blqd: 'zmd',
    jgbh: '1301232005',
    // logintoken: '21acb749edbc6284533f60d1ed648c0426:zmd',
    qycode: 'SZSY001',
    zjbzxbm: 'SZSY001',
    zzbm: 'bbPro',
    zzbs: '1301232005',
    zzjgdmz: 'SZSY001',
    // 'content-length': '17',
    'content-type': 'application/json;charset=UTF-8',
    'login-token': 'a7423d95bd332cb107b1a2923b45523121:zmd',
    'm-sy-appid': '2019082217092434',
    'm-sy-service': 'SZSY001',
    'm-sy-version': '1.0.1',
    client: 4,
  }
  $axios({
    method: 'POST',
    url,
    data: params,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8', // 指定消息格式
      ...addHeaders,
      ...headers,
    },
  }).then(result => {
    resolve(result.data)
  }).catch(error => {
    reject(error)
  })
})
